<?php
	include '../config.php';
	include '../include/ez_sql_core.php';
	include '../include/ez_sql_mysql.php';
	mb_internal_encoding("UTF-8");
	$db = new ezSQL_mysql($config['db']['dbuser'],$config['db']['dbpw'],$config['db']['dbname'],$config['db']['dbhost']);
	$db->query('set names '.$config['db']['dbcharset']);
	extract($_REQUEST);
	if($part=='news'){
		$sql = "select title,src,url from pic where lang = 'tc' and del = 0 order by queue asc , time desc limit 4";
		$img_results = $db->get_results($sql);
	}
	$sql = "select count(*) from contents where del = 0  and lang = 'tc' and part = '".$part."'";
	$total = $db->get_var($sql);
	$pagesize = 19;
	$pages = intval($total/$pagesize);
	if ($total%$pagesize){
		$pages++;
	}
	if (isset($page)){
		$page=intval($page);
	}else{
		$page=1;
	}
	$sql = "select id,title,DATE_FORMAT(time,'%Y-%m-%d') from contents where lang = 'tc' and  del = 0 and part = '".$part."' order by time desc limit ".($pagesize*($page-1))." , ".$pagesize;
	$results = $db->get_results($sql,ARRAY_N);
	if($db->num_rows > 0){
		$pagehtml = "<li><a href='/tc/list/".$part."/1.html'>首頁</a></li>";
		if ($pages == 1){
			$pagehtml = "";
		}else if($pages <= 10){ 
			for($i=1;$i<=$pages;$i++){ 
				($i == $page) ? $pagehtml .= "<li class='cur'><a href='/tc/list/".$part."/".$i.".html'>".$i."</a></li>": $pagehtml .= "<li><a href='/tc/list/".$part."/".$i.".html'>".$i."</a></li>";
			}
			$pagehtml .= "<li><a href='/tc/list/".$part."/".$pages.".html'>末頁</a></li>";
		}else{ 
			if ($page < 4){
				for($i=1;$i<=10;$i++){ //只顯示10頁
					($i == $page) ? $pagehtml .= "<li class='cur'><a href='/tc/list/".$part."/".$i.".html'>".$i."</a></li>": $pagehtml .= "<li><a href='/tc/list/".$part."/".$i.".html'>".$i."</a></li>"; 
				}
				$pagehtml .= "<li><a href='/tc/list/".$part."/".$pages.".html'>末頁</a></li>";
			}else if ($page >= 4 && $page < $pages-7 ){
				$pagehtml .= "<li><a href='/tc/list/".$part."/".($page-1).".html'>上一頁</a></li>";
				for($i=$page-2;$i<=$page+7;$i++){ //只顯示10頁
					($i == $page) ? $pagehtml .= "<li class='cur'><a href='/tc/list/".$part."/".$i.".html'>".$i."</a></li>" : $pagehtml .= "<li><a href='/tc/list/".$part."/".$i.".html'>".$i."</a></li>"; 
				}
				$pagehtml .= "<li><a href='/tc/list/".$part."/".($page+1).".html'>下一頁</a></li>";
				$pagehtml .= "<li><a href='/tc/list/".$part."/".$pages.".html'>末頁</a></li>";
			}else{
				$pagehtml .= "<li><a href='/tc/list/".$part."/".($page-1).".html'>上一頁</a></li>";
				for($i=$pages-9;$i<=$pages;$i++){ //只顯示10頁
					($i == $page) ? $pagehtml .= "<li class='cur'><a href='/tc/list/".$part."/".$i.".html'>".$i."</a></li>" : $pagehtml .= "<li><a href='/tc/list/".$part."/".$i.".html'>".$i."</a></li>"; 
				}
				$pagehtml .= "<li><a href='/tc/list/".$part."/".$pages.".html'>末頁</a></li>";
			}
		}
	}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php
				if($part=='news'){
				echo "新聞信息";
			}else if($part=='services'){
				echo "專業服務";
			}else if($part=='projects'){
				echo "項目介紹";
			}
			?> - 華碩投資</title>
<meta name="copyright" content="2001-2011 hs-i.NET" />
<link rel="archives" title="華碩投資" href="http://www.hs-i.cc" />
<meta name="keywords" content="華碩投資" />
<meta name="description" content="<?php
	$tmp = '';
	foreach ($results as $result){
		$tmp .= $result[1].',';
	}
echo mb_substr(rtrim($tmp,','), 0, 200);
?>" />
<meta name="generator" content="Media4Studio.com" />
<meta name="author" content="藍龍互動傳播機構" />
<meta name="copyright" content="2001-2011 華碩投資" />
<link rel="shortcut icon" href="/favorite.ico" type="image/x-icon" /> 
<link href="/tc/css/base.css" rel="stylesheet" type="text/css" />
<link href="/tc/css/main.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="main">
<div class="head">
    	<h1 class="logo"><a href="/">華碩投資</a></h1>
        <div class="nav">
        	<a href="/tc/index.html" class="n1">首頁</a>
            <a href="/tc/company/cp.html" class="company n2">公司概況</a>
            <a href="/tc/list/news.html" class="n3">新聞信息</a>
            <a href="/tc/list/services.html" class="n4">專業服務</a>
            <a href="/tc/list/projects.html" class="n5">項目介紹</a>
            <a href="/tc/contact/bi.html" class="n6">合作夥伴</a>
            <a href="/sc/index.html" class="lan">簡體</a><a href="/tc/index.html" class="lan">繁體</a>
         <div class="box">
        	<ul>
            	<li>▪<a href="/tc/company/cp.html">公司簡介</a></li>
                <li>▪<a href="/tc/company/ph.html">公司理念</a></li>
                <li>▪<a href="/tc/company/mt.html">管理團隊</a></li>
                <li>▪<a href="/tc/company/ho.html">資質榮譽</a></li>
            </ul>
        </div>
        </div>
    </div>
  <div class="con <?php
		if($part=='news'){
			echo "list_bg";
		}else if($part=='services'){
			echo "list_bg2";
		}else if($part=='projects'){
			echo "list_bg3";
		}
	?>">
    <div class="<?php
		if($part=='news'){
			echo "con_bg";
		}else if($part=='services'){
			echo "con_bg2";
		}else if($part=='projects'){
			echo "con_bg3";
		}
	?>">
        <div class="r_tit"> <a href="/tc/index.html">首頁</a>>
			<?php
			if($part=='news'){
				echo "<a href='/tc/list/news.html' class='blue'>新聞信息</a>";
			}else if($part=='services'){
				echo "<a href='/tc/list/services.html' class='blue'>專業服務</a>";
			}else if($part=='projects'){
				echo "<a href='/tc/list/projects.html' class='blue'>項目介紹</a>";
			}
		?>
		</div>
        <div class="flt">
        <div class="page" style="padding-top:64px;">
          <ul>
            <?php
				echo $pagehtml;
			?>
          </ul>
        </div>
        <div class="<?php
			if($part=='news'){
				echo "news_l";
			}else{
				echo "list_l";
			}
		?>">
          <ul>
            <?php
				if($db->num_rows > 0){
					foreach ($results as $result){
						echo "<li>▪<span class='time'>".(($part=='news')?$result[2]:'')."</span><a href='/tc/view/".$result[0].".html'>".(($part=='news')?((mb_strlen($result[1]) > 26)?(mb_substr($result[1], 0, 26).'...'):$result[1]):$result[1])."</a></li>";
					}
				}
			?>
          </ul>
        </div>
        <div class="page pa15">
          <ul>
            <?php
				echo $pagehtml;
			?>
          </ul>
        </div>
      </div>
      <div class="flr">
        <div class="l_pic">
          <ul>
			<?php
				if($part=='news'){
					foreach($img_results as $img_result){
						echo "<li><a href='".$img_result->url."'><img src='/upload/index_img/sc/small/".$img_result->src."' width='340' height='92' /></a><a href='#'>".$img_result->title."</a></li>";
					}
				}
		  ?>
          </ul>
        </div>
      </div>
    </div>
<div class="foot_bg">
    <div class="foot">
      <div class="flt">
        <p><img src="/tc/images/tc/f_x.jpg" width="269" height="59" alt="廣州華碩投資有限公司"/></p>
      </div>
      <div class="f_menu">
        <p class="ba">粵ICP備11007417號-1 &nbsp;<a href="http://www.lanon.com.cn" target="_blank">Powered by Lanon</a>&nbsp;<script src="http://s14.cnzz.com/stat.php?id=3385713&web_id=3385713&show=pic1" language="JavaScript"></script></p>
        <p class="fb"><a href="/tc/contact/cu.html" class="f1">聯系我們</a><a href="/tc/contact/sm.html" class="f2">網站地圖</a><a href="/tc/contact/ln.html" class="f3">法律聲明</a><a href="/tc/contact/li.html" class="f4">友情鏈接</a><a href="#5" class="f5">企業郵局</a></p>
      </div>
    </div>
  </div>
</div>
<script type="text/javascript" src="/tc/js/jquery.js"></script>
<script type="text/javascript" src="/tc/js/nav.js"></script>
</body>
</html>
